package com.zsxb.crm.controller;

import com.zsxb.crm.dto.BaseInfoDTO;
import com.zsxb.crm.result.Result;
import com.zsxb.crm.dto.BaseInfoDTO;
import com.zsxb.crm.dto.ReportDateDTO;
import com.zsxb.crm.result.Result;
import com.zsxb.crm.dto.BaseInfoDTO;
import com.zsxb.crm.result.Result;
import com.zsxb.crm.service.IndexService;
import com.zsxb.crm.vo.BaseInfo;
import com.zsxb.crm.vo.BaseInfo;
import com.zsxb.crm.vo.ClueTo20VO;
import com.zsxb.crm.vo.businessChangeVO;
import com.zsxb.crm.vo.BaseInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.List;
import java.util.List;

@RestController
@RequestMapping("/index")
@Slf4j
public class IndexController {
    @Autowired
    private IndexService indexService;
    //线索转化龙虎榜
    @GetMapping("/salesStatistic")
    private Result getClueTO20(@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate beginCreateTime,
                            @DateTimeFormat(pattern = "yyyy-MM-dd")LocalDate endCreateTime){

        List<ClueTo20VO> clueTO20VO = indexService.getClueTO20(beginCreateTime, endCreateTime);
        return Result.success(clueTO20VO);




    /**
     * 基础数据
     */


}
    @GetMapping
    private Result<BaseInfo> getBaseInfo(BaseInfoDTO baseInfoDTO){
        log.info("查询时间范围：{}",baseInfoDTO);
        BaseInfo info = indexService.getBaseInfo(baseInfoDTO.getBeginCreateTime(), baseInfoDTO.getEndCreateTime());
        return Result.success(info);
    }

    /**
     * 商机转化龙虎榜
     */
    @GetMapping("/businessChangeStatistics")
    private Result<List<businessChangeVO>> businessChangeStatistics(ReportDateDTO dateDTO){
        List<businessChangeVO> businessChange = indexService.businessChangeStatistics(dateDTO);
        return Result.success(businessChange);
    }





}
